using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Data;
using DTO;

using System.Data;

namespace Business
{
    public class ChucVuService
    {




		//////////////////////////////////////////////////////////

 		                                                         

		//            Enter code your here                      //

		                                                         

		//////////////////////////////////////////////////////////

       static public DataTable ConvertListChucVuDTOToDataTable( List<ChucVuDTO> lst)
       {
               DataTable dt = new DataTable();
           dt.Columns.Add( "MaChucVu");
           dt.Columns.Add( "TenChucVu");
           for( int i = 0; i < lst.Count; i ++)
           {
               dt.Rows.Add(
                       lst[i].MaChucVu,      
                       lst[i].TenChucVu      
                   );
           }
               return dt;
       }
        static public int GetIdentity()
        {
            Data.ChucVuRepository repo = new ChucVuRepository();
            return repo.GetIdentity();
        }

        static public int Count()
        {
            return ChucVuRepository.Count();
        }
        public static bool Them(ChucVuDTO objDTO)
        {
                ChucVuRepository repo = new ChucVuRepository();
                return repo.Them(objDTO);
        }

        public static bool Xoa(int MaChucVu, bool XoaKhoaNgoai=false)
        {
              ChucVuRepository Repo = new ChucVuRepository();
              return Repo.Xoa(MaChucVu,XoaKhoaNgoai);
        }

        public static void CapNhat(ChucVuDTO objDTO)
        {
            try
            {
                ChucVuRepository Repo = new ChucVuRepository();
                Repo.CapNhat(objDTO);
            }
            catch (System.Exception )
            {
            }
        }

        public static List<ChucVuDTO> LayDanhSach()
        {
            List<ChucVuDTO> lst = new List<ChucVuDTO>();
            try
            {
                ChucVuRepository obj = new ChucVuRepository();
                lst = obj.LayDanhSach();
            }
            catch (System.Exception )
            {
            }
            return lst;
        }

        static public List<ChucVuDTO> LayDanhSach(int Start, int Record)
        {
             Data.ChucVuRepository repo = new ChucVuRepository();
            return repo.LayDanhSach(Start, Record);
        }

        public static ChucVuDTO LayTheoMa(int MaChucVu)
        {
            ChucVuDTO objDTO = new ChucVuDTO();
            try
            {
                ChucVuRepository Repo = new ChucVuRepository();
                objDTO = Repo.LayTheoMa(MaChucVu);
            }
            catch (System.Exception )
            {
            }
            return objDTO;
        }
    }
}

